package com.qingxin.ui.bean;

import java.util.ArrayList;
import java.util.List;

import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class UITableColumn {
	
	private String display;
	private String name;
	private String width;
	private String align;
	private String frozen;
	private String sort;
	private String type;
	private String format;
	private String dynamic;
	private String hidein;
	private String empty;
	private String loop;//用于循环创建列
	private String render;
	private String totalSummary;
	
	//操作项
	private List<UIOperItem> operItems;
	
	public UITableColumn() {
	}
	
	public UITableColumn(String display, String name, String width, String align,
			String frozen, String sort, String type, String format,
			String dynamic, String hidein, String empty, String loop, String render, String totalSummary) {
		this.display = display;
		this.name = name;
		this.width = width;
		this.align = align;
		this.frozen = frozen;
		this.sort = sort;
		this.type = type;
		this.format = format;
		this.dynamic = dynamic;
		this.hidein = hidein;
		this.empty = empty;
		this.loop = loop;
		this.render = render;
		this.totalSummary = totalSummary;
	}

	public UITableColumn copy(){
		UITableColumn target = new UITableColumn(display, name, width, align, frozen, sort, type, format, dynamic, hidein, empty, loop, render, totalSummary);
		
		if(operItems != null){
			for(int i=0, n=operItems.size(); i<n; i++){
				target.addOperItem(operItems.get(i));
			}
		}
		
		return target;
	}


	public String getDisplay() {
		return display;
	}
	public void setDisplay(String display) {
		this.display = display;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getWidth() {
		return width;
	}
	public void setWidth(String width) {
		this.width = width;
	}
	public String getAlign() {
		return align;
	}
	public void setAlign(String align) {
		this.align = align;
	}
	public String getFrozen() {
		return frozen;
	}
	public void setFrozen(String frozen) {
		this.frozen = frozen;
	}
	public String getSort() {
		return sort;
	}
	public void setSort(String sort) {
		this.sort = sort;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getFormat() {
		return format;
	}
	public void setFormat(String format) {
		this.format = format;
	}
	public String getDynamic() {
		return dynamic;
	}
	public void setDynamic(String dynamic) {
		this.dynamic = dynamic;
	}
	public String getHidein() {
		return hidein;
	}
	public void setHidein(String hidein) {
		this.hidein = hidein;
	}
	public String getEmpty() {
		return empty;
	}
	public void setEmpty(String empty) {
		this.empty = empty;
	}
	public String getLoop() {
		return loop;
	}
	public void setLoop(String loop) {
		this.loop = loop;
	}
	public String getRender() {
		return render;
	}
	public void setRender(String render) {
		this.render = render;
	}
	public String getTotalSummary() {
		return totalSummary;
	}
	public void setTotalSummary(String totalSummary) {
		this.totalSummary = totalSummary;
	}

	
	public void addOperItem(UIOperItem operItem){
		if(operItems == null){
			operItems = new ArrayList<>();
		}
		operItems.add(operItem);
		render = "";
	}
	public List<UIOperItem> getOperItems() {
		return operItems;
	}
	public void setOperItems(List<UIOperItem> operItems) {
		this.operItems = operItems;
	}
	
	
}
